import 'package:flutter/material.dart';
import 'package:flutter_dwh5/application.dart';
import 'package:flutter_dwh5/pages/home/goodsDetail/pay/paySuccess.dart';
import 'package:flutter_dwh5/router/navigator_util.dart';
import 'package:flutter_dwh5/routes.dart';

class Pay extends StatefulWidget {
  @override
  State<Pay> createState() => _PayState();
}

class _PayState extends State<Pay> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('支付'),
        elevation: 0,
      ),
      body: Column(
        children: [
          Container(
            color: Colors.white,
            padding: EdgeInsets.only(bottom: 15),
            child: Column(
              children: [
                Container(
                  child: Image.asset(
                    'images/pay/pay.png',
                    width: 76,
                    height: 56,
                  ),
                  margin: EdgeInsets.only(top: 30),
                ),
                Container(
                  margin: EdgeInsets.only(top: 20),
                  child: Text(
                    '应付金额（元）',
                    style: TextStyle(color: Color.fromRGBO(153, 153, 153, 1)),
                  ),
                ),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.end,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Container(
                      margin: EdgeInsets.only(bottom: 5),
                      child: Text(
                        '￥',
                        style: TextStyle(fontSize: 18),
                      ),
                    ),
                    Container(
                      child: Text(
                        '666',
                        style: TextStyle(
                            fontSize: 36, fontWeight: FontWeight.bold),
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(bottom: 7),
                      child: Text(
                        '元',
                        style:
                            TextStyle(color: Color.fromRGBO(153, 153, 153, 1)),
                      ),
                    )
                  ],
                )
              ],
            ),
          ),
          Container(
            padding: EdgeInsets.all(15),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Container(
                  child: Text('支付方式'),
                  margin: EdgeInsets.only(bottom: 15),
                ),
                Divider(
                  height: 0.3,
                  color: Color.fromRGBO(225, 225, 225, 1),
                ),
                Container(
                  child: Row(
                    children: [
                      Container(
                        child: Image.asset(
                          'images/pay/wx.png',
                          width: 18.5,
                          height: 15.5,
                        ),
                      ),
                      Container(
                        child: Text(
                          '微信支付',
                          style: TextStyle(
                              color: Color.fromRGBO(153, 153, 153, 1)),
                        ),
                        margin: EdgeInsets.only(left: 5),
                      )
                    ],
                  ),
                  margin: EdgeInsets.only(top: 15, bottom: 24),
                ),
                Center(
                  child: SizedBox(
                    width: 300,
                    height: 48,
                    child: ElevatedButton(
                      style: ElevatedButton.styleFrom(primary: Colors.black),
                      onPressed: () {
                        // NavigatorUtil.push(Routes.paySuccess,
                        Navigator.push(
                            context,
                            MaterialPageRoute(
                                builder: (context) => PaySuccess(
                                      content: '我',
                                    )));
                      },
                      child: Text(
                        '确认支付',
                        style: TextStyle(color: Colors.white, fontSize: 16),
                      ),
                    ),
                  ),
                )
              ],
            ),
          )
        ],
      ),
    );
  }
}
